﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace syc.Sale
{
    public partial class YuanLiaoDaoHuo_MingXi : System.Web.UI.Page
    {
        private double   sum1 = 0;
        private double  sum2 = 0;
        private int sum3 = 0;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex >= 0)
            {
                if (e.Row.Cells[5].Text == ""||e.Row.Cells[5].Text=="&nbsp;")
                {
                   sum1 += Convert.ToDouble(0);
                }
                else
                {
                    sum1 += Convert.ToDouble(e.Row.Cells[5].Text);
                }
                if (e.Row.Cells[6].Text == "" || e.Row.Cells[6].Text=="&nbsp;")
                {
                    sum2 += Convert.ToDouble(0);
                }
                else
                {
                    sum2 += Convert.ToDouble(e.Row.Cells[6].Text);
                }
                if (e.Row.Cells[7].Text == ""||e.Row.Cells[7].Text=="&nbsp;")
                {
                    sum3 += Convert.ToInt32(0);
                }
                else
                {
                    sum3 += Convert.ToInt32(e.Row.Cells[7].Text);
                }
              
            }
            else if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[4].Text = "合    计：";
                e.Row.Cells[5].Text = sum1.ToString();
                e.Row.Cells[6].Text = sum2.ToString();
                e.Row.Cells[7].Text = sum3.ToString();
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("YuanLiao_DaoHuo_Search.aspx?GuanCai=" + Request.QueryString["GuanCai"]);
        }
    }
}
